package com.yimu.unknow;

import org.junit.Test;

public class A {
    String str1 = "skjflaaahssssaegjtoard";
    String str2 = "sssa";
    StringBuffer stringBuffer = new StringBuffer();

    @Test
    public void p(){
        System.out.println(stringBuffer.equals("")?1:2);
    }

    @Test
    public void pp(){
        for (int i = 0; i < str2.length(); i++) {
            for (int j = 0; j < str1.length(); j++) {
                while (i < str2.length() && j < str1.length()) {
                    if (str1.charAt(j) == str2.charAt(i)) {
                        stringBuffer.append(str1.charAt(j));
                        if (stringBuffer.length()==str2.length()) {
                            System.out.println(stringBuffer);
                            return;
                        }
                        j++;
                        i++;
                        continue;
                    }else{
                        stringBuffer=new StringBuffer();
                        j=j-i+1;
                        i=0;
                    }

                }
            }
        }

    }

    /**
     * @Author YiMu
     * @Date 2020/10/12 15:29
     * @Description
     */
    public static class C {
        @Test
        public void nih() {
            int[] nums= {2,3,4,5,6};
            int target=9;
            for (int i = 0; i < nums.length; i++) {
                for (int j = 0; j < nums.length; j++) {
                    if (nums[i]+nums[j] == target){
                        System.out.println("["+nums[i]+","+nums[j]+"]");
                    }
                }
            }
        }
    }

    static class Solution {
        public int[] twoSum(int[] nums, int target) {
            int[] result =new int[2];
            for (int i = 0; i < nums.length; i++) {
                for (int j = 0; j < nums.length; j++) {
                    if (nums[i]+nums[j] == target){
                        result[0]=nums[i];
                        result[1]=nums[j];
                        return result;
                    }
                }
            }
            return result;
        }
    }

    public static class B {
        String key = "qwertyuiopasdfghjklzxcvbnm";
        String abc = "abcdefghigklmnopqrstuvwxyz";
        String map = "It was the best of times,\n" +
                "it was the worst of times,\n" +
                "it was the age of wisdom,\n" +
                "it was the age of foolishness,\n" +
                "it was the epoch of belief,\n" +
                "it was the epoch of incredulity,\n" +
                "it was the season of Light,\n" +
                "it was the season of Darkness,\n" +
                "it was the spring of hope,\n" +
                "it was the winter of despair.";

        @Test
        public void jm(){

            String[] split1 = key.split("");
            String[] split2 = map.split("");
    //        for (String s : split2) {
    //            System.out.print(s);
    //        }
            System.out.println("a".hashCode());
        }
    }
}
